package keke;

import java.util.*;


class PersonOverride{
	private String name;
	private boolean gender;
	private int age;
	
	public PersonOverride(){
		this("default",1,true);
	}

	public PersonOverride(String name,int age,boolean gender){
		this.name=name;
		this.age=age;
		this.gender=gender;
	}	
	@Override
	public String toString() {
		return name+"-"+age+"-"+gender;
	}
	 public boolean equals(Object anObject)
     {
     	          if(this == anObject)
     	          {
     	        	  return  true;
     	          }
     	          
     	          if (anObject instanceof PersonOverride)
     	          {
     	        	 PersonOverride personOverride = (PersonOverride)anObject;
     	        	  if (personOverride.name.equals(this.name) &&(personOverride.age==this.age)&&(personOverride.gender==this.gender))
     	        	  {
     	        		  return true;
     	        	  }
     	          }    
     	          return false;
     }
}
public class Main0305 {
	public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n1=in.nextInt();     
        for(int i=0;i<n1;i++)
        {
        	System.out.println(new PersonOverride());
        }
        int n2=in.nextInt();
        PersonOverride[] personOverride = new PersonOverride[n2];
        for(int j=0;j<n2;){
        	PersonOverride person=new PersonOverride(in.next(),in.nextInt(),in.nextBoolean());
        	int k;
        	for(k=0;k<j;k++){
        		if(personOverride[k].equals(person)){
        			n2--;
        			break;
        		}
        	}
        	if(k==j){
        		personOverride[j]=person;
        		System.out.println(person.toString());
        		j++;
        	}
        }
        System.out.println(n2);
        System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
	}
}
